#include<stdio.h>
//判断某年某月有多少天

//函数声明
int get_days_of_year(int y,int m);
int is_leap_year(int y);

int main()
{
    int year = 0;
    int month = 0;
    printf("请输入年份和月份：\n");
    scanf("%d %d",&year,&month);

    int d = get_days_of_year(year,month);
    printf("%d \n",d);
    return 0;
}

int get_days_of_year(int y,int m)
{
    int days_of_month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
    int d = days_of_month[m];;

    if(is_leap_year(y) && m == 2){
        d += 1;
    }
    return d;
}

int is_leap_year(int y)
{
     if(((y%4==0)&&(y%100!=0))||(y%400==0)){
        return 1;
     }
     else{
        return 0;
     }
}
